xl: xl block-attach -N (dry run) option
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 28 Jun 2011 11:19:17 +0000 (12:19 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 28 Jun 2011 11:19:17 +0000 (12:19 +0100)
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/xl_cmdimpl.c
tools/libxl/xl_cmdtable.c

index d5c10eda39933b80ccb406f6e4e0e2f86ad9d187..5a11c633b552a577df5cf318aed101be0ecca4b5 100644 (file)
@@ -4060,6 +4060,22 @@ int main_blockattach(int argc, char **argv)
 
     disk.backend_domid = be_domid;
 
+    if (dryrun_only) {
+        /* fixme: this should be generated from the idl */
+        /* fixme: enums (backend, format) should be converted to strings */
+        printf("disk.backend_domid = %"PRIx32"\n", disk.backend_domid);
+        printf("disk.pdev_path =     %s\n",        disk.pdev_path);
+        printf("disk.vdev =          %s\n",        disk.vdev);
+        printf("disk.backend =       %d\n",        disk.backend);
+        printf("disk.format =        %d\n",        disk.format);
+        printf("disk.script =        %s\n",        disk.script);
+        printf("disk.removable =     %d\n",        disk.removable);
+        printf("disk.readwrite =     %d\n",        disk.readwrite);
+        printf("disk.is_cdrom =      %d\n",        disk.is_cdrom);
+        if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
+        return 0;
+    }
+
     if (libxl_device_disk_add(ctx, fe_domid, &disk)) {
         fprintf(stderr, "libxl_device_disk_add failed.\n");
     }
index 924920b88372a0817fbd1cfe76562d113b25b2c5..e6ff877415a37cac7d45548ee5b1720d9bf664ca 100644 (file)
@@ -256,7 +256,7 @@ struct cmd_spec cmd_table[] = {
       "<Domain> <DevId|mac>",
     },
     { "block-attach",
-      &main_blockattach, 0,
+      &main_blockattach, 1,
       "Create a new virtual block device",
       "<Domain> <disk-spec-component(s)>...",
     },